// https : // iai.sh.cn/problem/536
// 未完成
#include <cstring>
#include <iostream>
#include <vector>

const int MAXN = 200005;
const int MOD = 998244353;

std::vector<int> graph[MAXN];
long long dp[MAXN][2];
int n, t;

void dfs(int node, int parent) {
  dp[node][0] = 1;
  dp[node][1] = 1;

  for (int child : graph[node]) {
    if (child == parent)
      continue;

    dfs(child, node);

    dp[node][0] = (dp[node][0] * (dp[child][0] + dp[child][1])) % MOD;
    dp[node][1] = (dp[node][1] * dp[child][0]) % MOD;
  }
}

long long solve(int root) {
  dfs(root, -1);

  long long result = 0;
  for (int i = 1; i <= n; i++) {
    if (i == root)
      continue;
    result = (result + dp[i][1] * dp[root][0]) % MOD;
  }

  return result;
}

int main() {
  std::cin >> n >> t;

  for (int i = 0; i < n - 1; i++) {
    int u, v;
    std::cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  if (t == 1) {
    std::cout << n << std::endl;
  } else {
    std::cout << solve(1) << std::endl;
  }

  return 0;
}
